#include "tool.h"
LPSTR wchar2char(LPCWSTR wstr)
{
	char * m_char;
	int len = WideCharToMultiByte(CP_ACP, 0, wstr, (int)wcslen(wstr), NULL, 0, NULL, NULL);
	m_char = new char[len + 1];
	WideCharToMultiByte(CP_ACP, 0, wstr, (int)wcslen(wstr), m_char, len, NULL, NULL);
	m_char[len] = '\0';
	return m_char;
}

LPWSTR char2wchar(LPCSTR str)
{
	LPWSTR m_wchar;
	int len = MultiByteToWideChar(CP_ACP, 0, str, (int)strlen(str), NULL, 0);
	m_wchar = new wchar_t[len + 1];
	MultiByteToWideChar(CP_ACP, 0, str, (int)strlen(str), m_wchar, len);
	m_wchar[len] = '\0';
	return m_wchar;
}